﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GPSTrackingWebsiteManager.ClassManager
{
    public static class InvokeEntityManager
    {
        private static Hashtable Invoke_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Telerik.Web.UI.GridEditableItem item = e.Item as Telerik.Web.UI.GridEditableItem;
            Hashtable Entity = new Hashtable();
            item.ExtractValues(Entity);

            return Entity;
        }

        public static GPSTrackingDBV2.Entities.GpsType Invoke_GpsType_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.GpsType GpsTypeEntity = new GPSTrackingDBV2.Entities.GpsType();
            GpsTypeEntity.GpsTypeId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsTypeColumn.GpsTypeId.ToString()]);
            GpsTypeEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsTypeColumn.Name.ToString()]);

            return GpsTypeEntity;
        }

        public static GPSTrackingDBV2.Entities.GpsStock Invoke_GpsStock_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);
                        
            GPSTrackingDBV2.Entities.GpsStock GpsStockEntity = new GPSTrackingDBV2.Entities.GpsStock();
            GpsStockEntity.GpsImei = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.GpsImei.ToString()]);
            GpsStockEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.Name.ToString()]);
            GpsStockEntity.SimNumber = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.SimNumber.ToString()]);
            GpsStockEntity.Description = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.Description.ToString()]);
            GpsStockEntity.GpsModelId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.GpsModelId.ToString()]);
            GpsStockEntity.GpsTypeId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsStockColumn.GpsTypeId.ToString()]);
        
            return GpsStockEntity;
        }

        public static GPSTrackingDBV2.Entities.GpsGroups Invoke_GpsGroups_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.GpsGroups GpsGroupsEntity = new GPSTrackingDBV2.Entities.GpsGroups();
            GpsGroupsEntity.GpsGroupId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsGroupsColumn.GpsGroupId.ToString()]);
            GpsGroupsEntity.Name = Convert.ToString(Entity["GPSGroupIdSource.Name"]);            

            return GpsGroupsEntity;
        }

        public static GPSTrackingDBV2.Entities.Companies Invoke_Company_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.Companies CompanyEntity = new GPSTrackingDBV2.Entities.Companies();
            CompanyEntity.CompanyId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.CompaniesColumn.CompanyId.ToString()]);
            CompanyEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.CompaniesColumn.Name.ToString()]);
            CompanyEntity.Guid = Convert.ToString(Entity[GPSTrackingDBV2.Entities.CompaniesColumn.Guid.ToString()]);

            return CompanyEntity;

        }

        public static GPSTrackingDBV2.Entities.CompaniesByMasters Invoke_CompaniesByMasters_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.CompaniesByMasters CompaniesByMastersEntity = new GPSTrackingDBV2.Entities.CompaniesByMasters();
            CompaniesByMastersEntity.CompanyId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.CompaniesByMastersColumn.CompanyId.ToString()]);
            CompaniesByMastersEntity.MasterUsername = Convert.ToString(Entity[GPSTrackingDBV2.Entities.CompaniesByMastersColumn.MasterUsername.ToString()]);

            return CompaniesByMastersEntity;

        }

        public static GPSTrackingDBV2.Entities.Masters Invoke_Masters_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.Masters MasterEntity = new GPSTrackingDBV2.Entities.Masters();
            MasterEntity.MasterUsername = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.MasterUsername.ToString()]);
            MasterEntity.Password = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Password.ToString()]);
            MasterEntity.Identification = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Identification.ToString()]);
            MasterEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Name.ToString()]);
            MasterEntity.FirstName = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.FirstName.ToString()]);
            MasterEntity.LastName = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.LastName.ToString()]);
            MasterEntity.Email = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Email.ToString()]);
            MasterEntity.Mobile = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Mobile.ToString()]);
            MasterEntity.Phone = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersColumn.Phone.ToString()]);
            MasterEntity.IsActive = Convert.ToBoolean(Entity[GPSTrackingDBV2.Entities.MastersColumn.IsActive.ToString()]);
            MasterEntity.CreationDate = Convert.ToDateTime(Entity[GPSTrackingDBV2.Entities.MastersColumn.CreationDate.ToString()]);

            return MasterEntity;

        }

        public static GPSTrackingDBV2.Entities.Stock Invoke_Stock_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.Stock StockEntity = new GPSTrackingDBV2.Entities.Stock();

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.CompanyId.ToString()] != null)
                StockEntity.CompanyId = int.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.CompanyId.ToString()].ToString());
            
            if(Entity[GPSTrackingDBV2.Entities.StockColumn.StockId.ToString()] != null)
                StockEntity.StockId = int.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.StockId.ToString()].ToString());

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.StockCode.ToString()] != null)
                StockEntity.StockCode = Entity[GPSTrackingDBV2.Entities.StockColumn.StockCode.ToString()].ToString();

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.StockBarCode.ToString()] != null)
                StockEntity.StockBarCode = Entity[GPSTrackingDBV2.Entities.StockColumn.StockBarCode.ToString()].ToString();
            else
                StockEntity.StockBarCode = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.Name.ToString()] != null)
                StockEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.Name.ToString()].ToString());

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.Description.ToString()] != null)
                StockEntity.Description = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.Description.ToString()].ToString());
            else
                StockEntity.Description = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.PromotionalNote.ToString()] != null)
                StockEntity.PromotionalNote = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.PromotionalNote.ToString()].ToString());
            else
                StockEntity.PromotionalNote = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.Brand.ToString()] != null)
                StockEntity.Brand = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.Brand.ToString()].ToString());
            else
                StockEntity.Brand = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.UnitStock.ToString()] != null)
                StockEntity.UnitStock = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.UnitStock.ToString()].ToString());
            else
                StockEntity.UnitStock = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.UnitStockByBox.ToString()] != null)
                StockEntity.UnitStockByBox = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.UnitStockByBox.ToString()].ToString());
            else
                StockEntity.UnitStockByBox = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.StockCategoryId.ToString()] != null)
                StockEntity.StockCategoryId = int.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.StockCategoryId.ToString()].ToString());

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.Quantity.ToString()] != null)
                StockEntity.Quantity = int.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.Quantity.ToString()].ToString());
            else
                StockEntity.Quantity = 0;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.MinQuantity.ToString()] != null)
                StockEntity.MinQuantity = int.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.MinQuantity.ToString()].ToString());
            else
                StockEntity.MinQuantity = 0;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.ImageUrl.ToString()] != null)
                StockEntity.ImageUrl = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.ImageUrl.ToString()].ToString());

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.PdfDetailUrl.ToString()] != null)
                StockEntity.PdfDetailUrl = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockColumn.PdfDetailUrl.ToString()].ToString());
            else
                StockEntity.PdfDetailUrl = String.Empty;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.LastTick.ToString()] != null)
                StockEntity.LastTick = Int64.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.LastTick.ToString()].ToString());

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.Price.ToString()] != null)
                StockEntity.Price = decimal.Parse(Entity[GPSTrackingDBV2.Entities.StockColumn.Price.ToString()].ToString());
            else
                StockEntity.Price = 0;

            if (Entity[GPSTrackingDBV2.Entities.StockColumn.ReservedQuantity.ToString()] != null)
                StockEntity.ReservedQuantity = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.StockColumn.ReservedQuantity.ToString()].ToString());
            else
                StockEntity.ReservedQuantity = 0;

            return StockEntity;
        }

        public static GPSTrackingDBV2.Entities.Administrators Invoke_Administrator_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.Administrators AdminEntity = new GPSTrackingDBV2.Entities.Administrators();
            AdminEntity.AdminUsername = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.AdminUsername.ToString()]);
            AdminEntity.Password = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Password.ToString()]);
            AdminEntity.Identification = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Identification.ToString()]);
            AdminEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Name.ToString()]);
            AdminEntity.FirstName = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.FirstName.ToString()]);
            AdminEntity.LastName = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.LastName.ToString()]);
            AdminEntity.Email = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Email.ToString()]);
            AdminEntity.Mobile = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Mobile.ToString()]);
            AdminEntity.Phone = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.Phone.ToString()]);
            AdminEntity.IsActive = Convert.ToBoolean(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.IsActive.ToString()]);
            AdminEntity.CreationDate = Convert.ToDateTime(Entity[GPSTrackingDBV2.Entities.AdministratorsColumn.CreationDate.ToString()]);

            return AdminEntity;

        }

        public static GPSTrackingDBV2.Entities.ClientsGroups Invoke_ClientsGroups_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.ClientsGroups ClientsGroupsEntity = new GPSTrackingDBV2.Entities.ClientsGroups();
            ClientsGroupsEntity.ClientGroupId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.ClientsGroupsColumn.ClientGroupId.ToString()]);
            ClientsGroupsEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.ClientsGroupsColumn.Name.ToString()]);

            return ClientsGroupsEntity;
        }

        public static GPSTrackingDBV2.Entities.ClientsByClientsGroups Invoke_ClientsByClientsGroups_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.ClientsByClientsGroups ClientsByClientsGroupsEntity = new GPSTrackingDBV2.Entities.ClientsByClientsGroups();
            ClientsByClientsGroupsEntity.ClientGroupId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.ClientsByClientsGroupsColumn.ClientGroupId.ToString()]);
            ClientsByClientsGroupsEntity.ClientId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.ClientsByClientsGroupsColumn.ClientId.ToString()]);

            return ClientsByClientsGroupsEntity;
        }

        public static GPSTrackingDBV2.Entities.ClientsGroupsByCompanies Invoke_ClientsGroupsByCompanies_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.ClientsGroupsByCompanies ClientsGroupsByCompaniesEntity = new GPSTrackingDBV2.Entities.ClientsGroupsByCompanies();
            ClientsGroupsByCompaniesEntity.ClientGroupId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.ClientsGroupsByCompaniesColumn.ClientGroupId.ToString()]);
            ClientsGroupsByCompaniesEntity.CompanyId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.ClientsGroupsByCompaniesColumn.CompanyId.ToString()]);

            return ClientsGroupsByCompaniesEntity;
        }

        public static GPSTrackingDBV2.Entities.MastersRolesByMaster Invoke_MastersRolesByMaster_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.MastersRolesByMaster MastersRolesByMasterEntity = new GPSTrackingDBV2.Entities.MastersRolesByMaster();
            MastersRolesByMasterEntity.MasterUsername = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MastersRolesByMasterColumn.MasterUsername.ToString()]);
            MastersRolesByMasterEntity.MasterRoleId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MastersRolesByMasterColumn.MasterRoleId.ToString()]);

            return MastersRolesByMasterEntity;
        }

        public static GPSTrackingDBV2.Entities.AdministratorsRolesByAdministrator Invoke_AdministratorsRolesByAdministrator_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.AdministratorsRolesByAdministrator AdministratorsRolesByAdministratorEntity = new GPSTrackingDBV2.Entities.AdministratorsRolesByAdministrator();
            AdministratorsRolesByAdministratorEntity.AdminUsername = Convert.ToString(Entity[GPSTrackingDBV2.Entities.AdministratorsRolesByAdministratorColumn.AdminUsername.ToString()]);
            AdministratorsRolesByAdministratorEntity.AdministratorRoleId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.AdministratorsRolesByAdministratorColumn.AdministratorRoleId.ToString()]);

            return AdministratorsRolesByAdministratorEntity;
        }

        public static GPSTrackingDBV2.Entities.UserRolesByUsers Invoke_UserRolesByUsers_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.UserRolesByUsers UserRolesByUsersEntity = new GPSTrackingDBV2.Entities.UserRolesByUsers();
            UserRolesByUsersEntity.Username = Convert.ToString(Entity[GPSTrackingDBV2.Entities.UserRolesByUsersColumn.Username.ToString()]);
            UserRolesByUsersEntity.UserRolesId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.UserRolesByUsersColumn.UserRolesId.ToString()]);

            return UserRolesByUsersEntity;
        }

        public static GPSTrackingDBV2.Entities.NotificationsByGps Invoke_NotificationsByGps_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.NotificationsByGps NotificationsByGpsEntity = new GPSTrackingDBV2.Entities.NotificationsByGps();
            NotificationsByGpsEntity.GpsImei = Convert.ToString(Entity[GPSTrackingDBV2.Entities.NotificationsByGpsColumn.GpsImei.ToString()]);
            NotificationsByGpsEntity.NotificationId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.NotificationsByGpsColumn.NotificationId.ToString()]);
            NotificationsByGpsEntity.Value = Convert.ToString(Entity[GPSTrackingDBV2.Entities.NotificationsByGpsColumn.Value.ToString()]);
            NotificationsByGpsEntity.ParameterTypeId = Convert.ToString(Entity[GPSTrackingDBV2.Entities.NotificationsByGpsColumn.ParameterTypeId.ToString()]);

            return NotificationsByGpsEntity;
        }

        public static GPSTrackingDBV2.Entities.GpsModels Invoke_GpsModel_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.GpsModels GpsModelEntity = new GPSTrackingDBV2.Entities.GpsModels();
            GpsModelEntity.GpsModelId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsModelsColumn.GpsModelId.ToString()]);
            GpsModelEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.GpsModelsColumn.Name.ToString()]);
            GpsModelEntity.Port = Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.GpsModelsColumn.Port.ToString()]);
            GpsModelEntity.OriginalGpsModelId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.GpsModelsColumn.GpsModelId.ToString()]);


            return GpsModelEntity;
        }

        public static GPSTrackingDBV2.Entities.Menu Invoke_Menu_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.Menu MenuEntity = new GPSTrackingDBV2.Entities.Menu();
            MenuEntity.MenuId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MenuColumn.MenuId.ToString()]);
            MenuEntity.OriginalMenuId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MenuColumn.MenuId.ToString()]);            
            MenuEntity.Parent = Entity[GPSTrackingDBV2.Entities.MenuColumn.Parent.ToString()]== null ? (int?)null : Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MenuColumn.Parent.ToString()]);
            MenuEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MenuColumn.Name.ToString()]);           
            MenuEntity.ToolTip = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MenuColumn.ToolTip.ToString()]);
            MenuEntity.Page = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MenuColumn.Page.ToString()]);
            MenuEntity.IsVisibleMaster = Convert.ToBoolean(Entity[GPSTrackingDBV2.Entities.MenuColumn.IsVisibleMaster.ToString()]);
            MenuEntity.IsVisibleAdministrator = Convert.ToBoolean(Entity[GPSTrackingDBV2.Entities.MenuColumn.IsVisibleAdministrator.ToString()]);
            MenuEntity.IsVisibleUser = Convert.ToBoolean(Entity[GPSTrackingDBV2.Entities.MenuColumn.IsVisibleUser.ToString()]);
            MenuEntity.ImageUrl = Convert.ToString(Entity[GPSTrackingDBV2.Entities.MenuColumn.ImageUrl.ToString()]);
            MenuEntity.Width = Entity[GPSTrackingDBV2.Entities.MenuColumn.Width.ToString()] == null  ? (short?)null : Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.MenuColumn.Width.ToString()]);
            MenuEntity.Heigth = Entity[GPSTrackingDBV2.Entities.MenuColumn.Heigth.ToString()] == null ? (short?)null : Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.MenuColumn.Heigth.ToString()]);
            MenuEntity.Positionx = Entity[GPSTrackingDBV2.Entities.MenuColumn.Positionx.ToString()] == null ? (short?)null : Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.MenuColumn.Positionx.ToString()]);
            MenuEntity.Positiony = Entity[GPSTrackingDBV2.Entities.MenuColumn.Positiony.ToString()] == null ? (short?)null : Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.MenuColumn.Positiony.ToString()]);
            MenuEntity.TypeModuleId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MenuColumn.TypeModuleId.ToString()]);
            MenuEntity.MenuTypeId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.MenuColumn.MenuTypeId.ToString()]);
            MenuEntity.BySequence = Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.MenuColumn.BySequence.ToString()]);

            return MenuEntity;
        }

        public static GPSTrackingDBV2.Entities.StockFiles Invoke_StockFile_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.StockFiles StockFilesEntity = new GPSTrackingDBV2.Entities.StockFiles();
            StockFilesEntity.CompanyId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.StockFilesColumn.CompanyId.ToString()]);
            StockFilesEntity.StockFileId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.StockFilesColumn.StockFileId.ToString()]);
            StockFilesEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockFilesColumn.Name.ToString()]);
            StockFilesEntity.Filename = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockFilesColumn.Filename.ToString()]);
            StockFilesEntity.StockFileTypeOfFileId = Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.StockFilesColumn.StockFileTypeOfFileId.ToString()]);

            return StockFilesEntity;
        }

        public static GPSTrackingDBV2.Entities.StockFilesTypeOfFile Invoke_StockFileTypeOfFile_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.StockFilesTypeOfFile StockFilesTypeOfFileEntity = new GPSTrackingDBV2.Entities.StockFilesTypeOfFile();
            StockFilesTypeOfFileEntity.StockFileTypeOfFileId = Convert.ToInt16(Entity[GPSTrackingDBV2.Entities.StockFilesTypeOfFileColumn.StockFileTypeOfFileId.ToString()]);
            StockFilesTypeOfFileEntity.Name = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockFilesTypeOfFileColumn.Name.ToString()]);

            return StockFilesTypeOfFileEntity;
        }


        public static GPSTrackingDBV2.Entities.StockFilesByUsername Invoke_StockFilesByUsername_Entity(Telerik.Web.UI.GridCommandEventArgs e)
        {
            Hashtable Entity = Invoke_Entity(e);

            GPSTrackingDBV2.Entities.StockFilesByUsername StockFilesByUsernameEntity = new GPSTrackingDBV2.Entities.StockFilesByUsername();
            StockFilesByUsernameEntity.CompanyId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.StockFilesByUsernameColumn.CompanyId.ToString()]);
            StockFilesByUsernameEntity.StockFileId = Convert.ToInt32(Entity[GPSTrackingDBV2.Entities.StockFilesByUsernameColumn.StockFileId.ToString()]);
            StockFilesByUsernameEntity.Username = Convert.ToString(Entity[GPSTrackingDBV2.Entities.StockFilesByUsernameColumn.Username.ToString()]);


            return StockFilesByUsernameEntity;
        }
    
    }
}